
import VueRouter from 'vue-router';
import Store from './store/index.js'
let routes = [
    {
        path:'/',
        component:require('./page/index.vue'),
        meta:{}
    },

];
const  router=new VueRouter({
    mode:'history',
    routes
})

router.beforeEach((to,from,next)=>{

    if(to.meta.requireAuth) {
    if (Store.state.user.authenticated || JwtToken.getToken) {
          console.log(1111);
        return next();
    } else {
        return next({'name': 'login'});
    }
}
return next();
});

export default router;